@extends('admin.public.base')


@section('title', '商品管理')


@section('content')


    @if(session('status'))
        <script>
            setTimeout(() => {
                layer.msg("{{session('status')}}");
            }, 100)
        </script>
    @endif




    <nav class="breadcrumb"><i class="Hui-iconfont">&#xe67f;</i> 首页 <span class="c-gray en">&gt;</span> 产品管理 <span
                class="c-gray en">&gt;</span> 产品分类 <a class="btn btn-success radius r"
                                                      style="line-height:1.6em;margin-top:3px"
                                                      href="javascript:location.replace(location.href);" title="刷新"><i
                    class="Hui-iconfont">&#xe68f;</i></a>
    </nav>


    <div class="Hui-article">
        <div>
            <div class="pd-20">
                <div class="text-c">
                    <form action="">
                        <input type="text" name="keyword" value="{{isset($_GET['keyword'])?$_GET['keyword']:''}}"
                               placeholder=" 产品名称" style="width:250px" class="input-text">
                        <button class="btn btn-success" type="submit"><i class="Hui-iconfont">&#xe665;</i>
                            搜索
                        </button>
                    </form>
                </div>
            </div>
        </div>

        <article class="cl pd-20">
            <div class="cl pd-5 bg-1 bk-gray mt-20">
                <span class="l">
                    <a class="btn btn-primary radius" onclick="product_add('添加商品','/admin/goods/create')"
                       href="javascript:;">
                        <i class="Hui-iconfont">&#xe600;</i> 添加商品</a>
                </span>
            </div>
            <table class="table table-border table-bordered table-bg table-hover table-sort">
                <tr>
                    <td width="10">商品名称</td>
                    <td width="30">所属栏目</td>
                    <td width="40">列表</td>
                    <td width="20">编辑</td>
                </tr>

                @foreach($goodsDatas as $goodsData)
                    <tr>
                        <td>{{$goodsData['title']}}</td>
                        <td>{{$goodsData->beCat->name}}</td>
                        <td><img src="/{{$goodsData['list_img']}}" style="width: 50px;height: 43px;"></td>
                        <td>
                            <a href="/admin/goodslist/{{$goodsData['id']}}" class="btn btn-xs btn-info">添加货品</a>
                            <a href="javascript:;"
                               onclick="product_add('编辑商品','/admin/goods/{{$goodsData['id']}}/edit')"
                               class="btn btn-xs btn-warning">编辑</a>
                            <form action="/admin/goods/{{$goodsData['id']}}" method="post" style="display: inline">
                                @method('DELETE')
                                @csrf
                                <button onclick="return confirm('ok？')" type="submit" class="btn btn-xs btn-danger">
                                    删除
                                </button>
                            </form>
                        </td>
                    </tr>
                @endforeach
            </table>

            <style>
                .page {
                    text-align: center;
                    padding: 10px;
                }
                .page ul li {
                    float: left;
                    padding: 5px 10px;
                    color: dodgerblue;
                    border: 1px dodgerblue solid;
                    border-radius: 5px;
                    margin-left: 5px;
                }
                .page ul li a{
                    padding: 5px;
                }
            </style>
            <div class="page">
                <code>共{{ $goodsDatas->total() }}条</code>
                {{ $goodsDatas->links() }}<br>
            </div>
        </article>
    </div>
@endsection
